home *** CD-ROM | disk | FTP | other *** search
/ Isometric Game Programming with DirectX 7.0 / Isometric Game Programming.iso / directx / dxf / extras / direct3d / tools / 3dsmax3 / readme.txt < prev    next >
Encoding:
Text File  |  2000-09-22  |  9.5 KB  |  211 lines

  1. A 3DSMaxR3 -> X-file exporter with support for Physique modifiers.
  2.  
  3. Installation
  4. ------------
  5.  
  6. Copy XSkinExp.dle into <3DSMAXR3 path>\plugins
  7.  
  8. Usage
  9. -----
  10.  
  11. 1) Setup your scene.
  12. 2) Choose export (or export selected) from the File menu.
  13. 3) Select a filename through the standard dialog that should pop up.
  14. 4) Select an X-file data format to use (text, binary or binary+compressed).
  15. 5) Hit Go!
  16.  
  17. Notes
  18. -----
  19.  
  20. 1) The exporter currently only exports base objects (i.e. modifier stacks are ignored).  So any modifiers that you apply must be collapsed before export.  You can save your data to a MAX file before collapsing if you want to get your modifier stacks back.  The exception is the physique modifiers - see (2).
  21.  
  22. 2) If you use physique, before export make sure that no modifiers exist below either one in the stack.  Any modifiers above or below physique are just ignored.
  23.  
  24. 3) Currently only the diffuse texture is exported (absolute file path), and at most one set of texture coordinates (applied with a UVW modifier for example, and then collapsed before export).
  25.  
  26. 4) Material properties exported are:
  27.     - diffuse color
  28.     - transparency
  29.     - specular color
  30.     - emissive color
  31.     - texture file name (diffuse texture absolute file path).
  32.  
  33. 5) Materials may be per-mesh or per-face (multi-material).  
  34.  
  35. 6) Faces are always triangles.
  36.  
  37. 7) The export process guarantees that all frames (bones/nodes, whatever you want to call them) in the scene hierarchy get unique string names.  If a node has a name in 3DS, the exported name will use that, and append numbers if necessary to guarantee uniqueness.  3DS node names also have to be "censored" to support the character restrictions for strings in the x-file format.
  38.  
  39. 8) See the Notes on New Templates to learn about extensions added to the X-File format...
  40.  
  41. 9) The definitions of any new templates are always listed at the beginning of exported x-files.
  42.  
  43. 10) Physique files file created with versions of Character Studio older than v2.2 may not export correctly. This is due to the function GetInitNodeTM not working on these models. An example of this is babyenv.max that comes with Character Studio. To work around this problem do as follows:
  44. - Select the Biped root node
  45. - Go to the Motion tab and set the biped to figure mode.
  46. - For each node containing a physique modifier:
  47.     - Select the node
  48.     - Go to the modifier stack and select Physique
  49.     - Save a physique file (.phy) for that node
  50.     - Reinitialize Physique (everything)
  51.     - Load the saved physique file (all links)
  52. - Save fixed model if required
  53. - Export it as .X
  54.  
  55.  
  56.  
  57. Notes on New Templates
  58. ----------------------
  59. The c header file appended to the bottom of this readme may be used to help read the custom templates added to the x-file format.
  60.  
  61. For now, these templates are:
  62.  
  63. 1) VertexDuplicationIndices
  64.  
  65.         template VertexDuplicationIndices
  66.         {
  67.             <B8D65549-D7C9-4995-89CF-53A9A8B031E3>
  68.             DWORD nIndices;
  69.             DWORD nOriginalVertices;
  70.             array DWORD indices[nIndices];
  71.         }
  72.  
  73. This template is instantiated on a per-mesh basis, holding information about which vertices in the mesh are duplicates of each other.  Duplicates result when a vertex sits on a smoothing group or material boundary.  The purpose of this template is to allow the loader to determine which vertices exhibiting different peripheral parameters are actually the same vertex in the model.  Certain applications (mesh simplification for example) can make use of this information.
  74.  
  75. Fields: 
  76.  
  77. DWORD nIndices --  the number of indices in the array indices[nIndices].  This will be equal to the number of vertices in the current mesh.
  78.  
  79. DWORD nOriginalVertices -- the number of vertices in the mesh before any duplication occured.
  80.  
  81. array DWORD indices[nIndices] -- indices[n] holds the vertex index that vertex[n] in the vertex array for the mesh would have had if no duplication had occured.  So any indices in this array that are the same indicate duplicated vertices.
  82.  
  83. 2) XSkinMeshHeader
  84.  
  85.         template XSkinMeshHeader
  86.         {
  87.             <3CF169CE-FF7C-44ab-93C0-F78F62D172E2>
  88.             WORD nMaxSkinWeightsPerVertex;
  89.             WORD nMaxSkinWeightsPerFace;
  90.             WORD nBones; 
  91.         }
  92.  
  93. This template is instantiated on a per-mesh basis only in meshes that contain exported skinning information.  The purpose of this template is to provide information about the nature of the skinning information that was exported.
  94.  
  95. Fields:
  96. WORD nMaxSkinWeightsPerVertex -- the maximum number of transfoms that affect a vertex in the mesh.
  97.  
  98. WORD nMaxSkinWeightsPerFace -- the maximum number of unique transforms that affect the three vertices of any face.
  99.  
  100. WORD nBones -- the number of bones that affect vertices in this mesh
  101.  
  102. 3) SkinWeights
  103.  
  104.         template SkinWeights
  105.         { 
  106.             <6F0D123B-BAD2-4167-A0D0-80224F25FABB> 
  107.             STRING transformNodeName;
  108.             DWORD nWeights; 
  109.             array DWORD vertexIndices[nWeights]; 
  110.             array float weights[nWeights]; 
  111.             Matrix4x4 matrixOffset; 
  112.         } 
  113.  
  114. This template is instantiated on a per-mesh basis.  Within a mesh, a sequence of n instances of this template will show up, where n is the number of bones (X file frames) which influence the vertices in the mesh.  Each instance of the template basically defines the influence of a particular bone on the mesh.  There is a list of vertex indices, and a corresponding list of weights.
  115.  
  116. Fields:
  117. STRING transformNodeName -- the name of the bone whose influence we are defining.
  118.  
  119. DWORD nWeights -- the number of vertices affected by this bone
  120.  
  121. array DWORD vertexIndices[nWeights] -- the vertices influenced by this bone
  122.  
  123. array float weights[nWeights] -- the weights for each of the vertices influenced by this bone
  124.  
  125. Matrix4x4 matrixOffset -- this matrix transforms the mesh vertices to the space of the bone. This when cancatenated to the bone's transform will give the world space coordinates of the mesh as affected by the bone.
  126.  
  127. 4) Addition to AnimationKey
  128.  
  129.     template AnimationKey
  130.     {
  131.         <10DD46A8-775B-11cf-8F52-0040333594A3>
  132.         DWORD keyType;
  133.         DWORD nKeys;
  134.         array keys TimedFloatKeys[nKeys];
  135.     }
  136.  
  137. This is an existing template in .X files. This has been extended to support a new key type of 4 which is a matrix key (in addition to position, rotation and scale). For example:
  138.  
  139. AnimationKey 
  140. {
  141.     4;
  142.     2;
  143.     0;16;   0.999841,-0.017505, 0.003500,0.000000,
  144.             0.017664, 0.998492,-0.051979,0.000000,
  145.            -0.002585, 0.052033, 0.998642,0.000000,
  146.        28.181364,-0.033845, 0.001760,1.000000;;,
  147.     160;16; 0.999854,-0.016764, 0.003258,0.000000,
  148.         0.016922, 0.998239,-0.056864,0.000000,
  149.        -0.002299, 0.056911, 0.998377,0.000000,
  150.        28.181427,-0.033822, 0.001927,1.000000;;,
  151. }
  152. This was added to export animations from Biped plug-in. Biped does not give access to position / rotation / scale components of the animation. These matrices need to be decomposed by the application to get interpolable components.
  153.  
  154. Notes on Building the source
  155. ----------------------------
  156. To build the exporter from the sources, you must have the 3DSMax 3.x SDK and Character Studio 2.2 installed. The source code has a Microsoft Visual c++  6.0 project file included. You must add to the include path the location of the max sdk include directory (e.g. c:\3dsmax3\maxsdk\include) and the Character Studio docs directory (e.g. c:\3dsmax3\cstudio\docs). You also need to add the maxsdk lib directory to the libraries path (e.g c:\3dsmax3\maxsdk\lib). You also need to have the include and lib path to the DirectX 8.0 SDK to build.
  157.  
  158. Useful Header
  159. -------------
  160. The rest of this readme contains a useful header file, used in the export process, and useful for your loader, if you use the X File loading API in the DirectX SDK.
  161.  
  162. //-----------------------------------------------------------------------------
  163. // File: XSkinExpTemplates.h
  164. //
  165. // Desc: Custom templates used for skin export format.
  166. //
  167. // Copyright (C) 1998-2000 Microsoft Corporation. All Rights Reserved.
  168. //-----------------------------------------------------------------------------
  169. #ifndef __XSKINEXPTEMPLATES_H__
  170. #define __XSKINEXPTEMPLATES_H__
  171.  
  172. // {3CF169CE-FF7C-44ab-93C0-F78F62D172E2}
  173. DEFINE_GUID(DXFILEOBJ_XSkinMeshHeader,
  174. 0x3cf169ce, 0xff7c, 0x44ab, 0x93, 0xc0, 0xf7, 0x8f, 0x62, 0xd1, 0x72, 0xe2);
  175.  
  176. // {B8D65549-D7C9-4995-89CF-53A9A8B031E3}
  177. DEFINE_GUID(DXFILEOBJ_VertexDuplicationIndices, 
  178. 0xb8d65549, 0xd7c9, 0x4995, 0x89, 0xcf, 0x53, 0xa9, 0xa8, 0xb0, 0x31, 0xe3);
  179.  
  180. // {6F0D123B-BAD2-4167-A0D0-80224F25FABB}
  181. DEFINE_GUID(DXFILEOBJ_SkinWeights, 
  182. 0x6f0d123b, 0xbad2, 0x4167, 0xa0, 0xd0, 0x80, 0x22, 0x4f, 0x25, 0xfa, 0xbb);
  183.  
  184. #define XSKINEXP_TEMPLATES \
  185.         "xof 0303txt 0032\
  186.         template XSkinMeshHeader \
  187.         { \
  188.             <3CF169CE-FF7C-44ab-93C0-F78F62D172E2> \
  189.             WORD nMaxSkinWeightsPerVertex; \
  190.             WORD nMaxSkinWeightsPerFace; \
  191.             WORD nBones; \
  192.         } \
  193.         template VertexDuplicationIndices \
  194.         { \
  195.             <B8D65549-D7C9-4995-89CF-53A9A8B031E3> \
  196.             DWORD nIndices; \
  197.             DWORD nOriginalVertices; \
  198.             array DWORD indices[nIndices]; \
  199.         } \
  200.         template SkinWeights \
  201.         { \
  202.             <6F0D123B-BAD2-4167-A0D0-80224F25FABB> \
  203.             STRING transformNodeName;\
  204.             DWORD nWeights; \
  205.             array DWORD vertexIndices[nWeights]; \
  206.             array float weights[nWeights]; \
  207.             Matrix4x4 matrixOffset; \
  208.         } \
  209. #endif //__XSKINEXPTEMPLATES_H__
  210.  
  211.